package de.hdu.myjobapp.view.component;


import com.vaadin.ui.*;
import com.vaadin.ui.Button.ClickEvent;

import de.hdu.myjobapp.view.MyJobApplication;

/**
 * Creates The Visuals and Buttons for the User Menu after the User logs in
 * @author motz
 *
 */
@SuppressWarnings("serial")
public class Menu extends HorizontalLayout {

/**
 * Button for opening "�bersicht"
 */
	private final Button cmduebersicht = new Button("Übersicht",
			new Button.ClickListener() {
				public void buttonClick(ClickEvent e) {
					MyJobApplication.getProject().getUiHandler().switchView("uebersicht");
				}
	});
/**
 * Button for opening "Firma"
 */
	private final Button cmdfirma = new Button("Firma",
			new Button.ClickListener() {
				public void buttonClick(ClickEvent e) {
					MyJobApplication.getProject().getUiHandler().switchView("firmaview");
				}
	});

//	private final Button cmdAbewerbungen = new Button("Alle Bewerbungen",
//			new Button.ClickListener() {
//				public void buttonClick(ClickEvent e) {
//					MyJobApplication.getProject().getUiHandler().switchView("bewerbungview");
//				}
//	});
/**
 * Button for opening "Berichte"
 */
	private final Button cmdBerichte = new Button("Berichte",
	new Button.ClickListener() {
		public void buttonClick(ClickEvent e) {
			MyJobApplication.getProject().getUiHandler().switchView("berichte");
		}
});

/**
 * 	Button for a new Application
 */
	private final Button cmdauswertung = new Button("Neue Bewerbung",
			new Button.ClickListener() {
				public void buttonClick(ClickEvent e) {
					MyJobApplication.getProject().getUiHandler().setApplicationEditorApp(null, true);
					MyJobApplication.getProject().getUiHandler().switchView("applicationEditor");
				}
	});
/**
 * Method for creating Menu
 */
	public Menu() {

		// Visual modifiers of the menu.

		setWidth("100%");
		Panel panel = new Panel();
		panel.setSizeFull();
		panel.setScrollable(false);
//		panel.setHeight("150");

//
		HorizontalLayout layout = new HorizontalLayout();
		layout.setWidth("100%");
		cmduebersicht.setWidth("100%");
		layout.addComponent(cmduebersicht);
		layout.setExpandRatio(cmduebersicht, 1);
		cmdfirma.setWidth("100%");
		layout.addComponent(cmdfirma);
		layout.setExpandRatio(cmdfirma, 1);
		cmdauswertung.setWidth("100%");
		cmdBerichte.setWidth("100%");
		layout.addComponent(cmdBerichte);
		layout.setExpandRatio(cmdBerichte, 1);
		layout.addComponent(cmdauswertung);
		layout.setExpandRatio(cmdauswertung, 1);
		
//		
//
	
		panel.addComponent(layout);
		addComponent(panel);

	}


}
